const { Service } = require("egg");

class AclService extends Service {
    /**
     * 根据角色id，获取权限列表
     * @param {number} rid 角色id
     */
    async readListMenuByRid(rid) {
        let sql = `
            select a.name, a.path
            from acl as a
            join r_role_acl as rra on a.id = rra.aid
            where rra.rid = ?
        `;
        let params = [rid];
        let res = await this.app.mysql.query(sql, params);
        return res;
    }
}

module.exports = AclService;
